<?php
class CityViewModel extends ViewModel{
	public $viewFields = array(
	
			'city'=>array('*' ,'_as'=>'c' ),
			'province'=>array('*','_as'=>'p','_on'=>'c.provincecode=p.code'),
	
	);
	
	
	//獲取所有信息
	public function getAll($where,$limit,$order){
		return $this->where($where)->field('c.name as c_name,p.name as p_name,c.id as id')->limit($limit)->order($order)->select();
	}
	//獲取一條信息
	public function getOne($where){
		return $this->where($where)->find();
	}
}